<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery-1.12.4.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/axios-0.18.0.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/antd.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/antd.css" />
		<script src="js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />

		<style type="text/css">
			tr {
				height: 50px;
			}
		</style>
	</head>
	<body>
		<div id="app">
				<div style="50px;font-size: 20px;line-height: 50px;padding-left: 50px;">
				添加管理员
			</div>
			
			<table border="0px" style="margin: auto;width: 80%;margin-top: 50px;">
				<tr>
					<td style="width: 15%;text-align: right;"><span style="color: red;">*</span>管理员：&nbsp;&nbsp;&nbsp;&nbsp;</td>
					<td style="width: 70%;"><input type="text" name="" id="supername" :value="supername" style="width: 100%;"/></td>
				</tr>
				<tr>
					<td style="width: 15%;text-align: right;"><span style="color: red;">*</span>密码：&nbsp;&nbsp;&nbsp;&nbsp;</td>
					<td style="width: 70%;"><input type="password" name="" id="superpassword" :value="superpassword" style="width: 100%;"/></td>
				</tr>
				<tr>
					<td style="width: 15%;text-align: right;"><span style="color: red;">*</span>手机：&nbsp;&nbsp;&nbsp;&nbsp;</td>
					<td style="width: 70%;"><input type="tel" name="" id="phone" :value="superpassword" style="width: 100%;"/></td>
				</tr>
				<tr>
					<td style="width: 15%;text-align: right;"><span style="color: red;">*</span>邮箱：&nbsp;&nbsp;&nbsp;&nbsp;</td>
					<td style="width: 70%;"><input type="email" name="" id="email" :value="email" style="width: 100%;"/></td>
				</tr>
				<tr>
					<td style="width: 15%;text-align: right;"></td>
					<td style="width: 70%;">
						<span style="background: skyblue;color: white;border-radius: 5px;text-align: center;width: 70px;height: 30px;line-height: 30px;" class="glyphicon glyphicon-picture" aria-hidden="true" @click="insert()">保存</span>
						<span style="background: #BFBFBF;border-radius: 5px;text-align: center;width: 65px;height: 30px;line-height: 30px;display: inline-block;" onclick="window.location.href='user.html'">取消</span>
					</td>
				</tr>
				
			</table>

		</div>
	</body>
</html>
<script type="text/javascript">
	var vm = new Vue({
		el: "#app",
		data: {},
		beforeMount: {



		},
		methods: {
			insert: function() {
				if (sessionStorage.getItem("superid") == null) {
					alert("请登录！！！")
					window.location.href = "login.html";
				}
				if ($("#supername").val() == "") {
					alert("管理员不能为空！！！")
				} else {
					axios({
						method: "POST",
						url: "http://localhost:8080/Blogs_demo/admin/adminInsert",
						data: {
							"supername": $("#supername").val(),
							"superpassword": $("#superpassword").val(),
							"phone": $("#phone").val(),
							"email": $("#email").val(),
							
						},

					}).then(res => {
						console.log(res.data);
						window.location.href = "Admin.html"
					}).catch(err => {

						alert("服务出错了!!")
					})
				}
			}


		}


	})
</script>
